From 00f2d7a4dbe5351f74e77cb3636897dc20ecb30b Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20H=C3=A4rdeman?= Date: Tue, 9 Dec 2025 09:21:11 +0100 Subject: [PATCH] dhcpv4: don't send zero IPv6-only preferred option MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit As noted in https://github.com/openwrt/openwrt/issues/21048, if the ipv6_only_preferred option isn't set (or is set to zero), odhcpd will still include the IPv6-Only Preferred option (with a zero value) in DHCPv4 replies, while it should not return the option at all. Closes: https://github.com/openwrt/openwrt/issues/21048 Signed-off-by: David Härdeman Link: https://github.com/openwrt/odhcpd/pull/341 Signed-off-by: Álvaro Fernández Rojas --- src/dhcpv4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dhcpv4.c b/src/dhcpv4.c index 5073d97..31ef1e5 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -1306,7 +1306,8 @@ void dhcpv4_handle_msg(void *src_addr, void *data, size_t len, break; case DHCPV4_OPT_IPV6_ONLY_PREFERRED: - iov[IOV_IPV6_ONLY_PREF].iov_len = sizeof(reply_ipv6_only); + if (iface->dhcpv4_v6only_wait) + iov[IOV_IPV6_ONLY_PREF].iov_len = sizeof(reply_ipv6_only); break; case DHCPV4_OPT_CAPTIVE_PORTAL: -- 2.30.2